﻿@model IEnumerable<VehicleManagement.Models.Apply>
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@*<h2>预览用车申请</h2>*@
@*<script type="text/javascript">
    $(function () {
        //        alert($.query.get("DriverName"));
        $.post("/Apply/GetPagingInfo", {},
            function (data) {
                $("#TotalItems").text(data.TotalItems);
                $("#ItemsPerPage").text(data.ItemsPerPage);
                $("#TotalPages").text(data.TotalPages);
                $("#CurrentPage").text(data.CurrentPage);
            });
    });
</script>*@
<script src="@Url.Content("~/Scripts/SetPagingScript.js")" type="text/javascript"></script>
<script type="text/javascript">

    $(function () {
        if ($.query.get("Page") != "") {
            $("#Page").val($.query.get("Page"));
        }
        else {
            $("#Page").val(1);
        }

        if ($.query.get("applicant") != "" && !$.query.get("applicant")) {
            $("input[name='applicant']").val($.query.get("applicant"));
        }

        if ($.query.get("carType") != "" && !$.query.get("carType")) {
            $("input[name='carType']").val($.query.get("carType"));
        }

        if ($.query.get("applyState") != "" && !$.query.get("applyState")) {
            $("input[name='applyState']").val($.query.get("applyState"));
        }

        $.get("/Apply/GetPagingInfo",
            {
                applicant: $("input[name='applicant']").val(),
                carType: $("input[name='carType']").val(),
                applyState: $("input[name='applyState']").val(),
                Page: $("#Page").val()
            },
            function (data) {
                $("#TotalItems").text(data.TotalItems);
                $("#ItemsPerPage").text(data.ItemsPerPage);
                $("#TotalPages").text(data.TotalPages);
                $("#CurrentPage").text($("#Page").val());
            }
        );
        SetPagingOperation();
    });
    function DeleteAddGas(id) {
        if (confirm("你确认删除这条加油信息吗?")) {
            $.post("/AddGas/DeleteAddGas", "id=" + id, function (ret) {
                if (ret.Result == "true") {
                    alert(ret.Message);
                    window.location.reload();
                }
                else {
                    alert(ret.Message);
                }
            }, "json");
        }
    }
</script>
<div class="mas">
    <div class="toptitle">
        申请人平台
    </div>
    @*<div class="car"></div>*@
    @Html.Partial("_PartviewDriverManager")
    <div class="rightshow">
        <div class="classifyinfo">
            <div class="system-location">
                <a>申请系统</a>>><a>申请表状态</a>
            </div>
            <div class="system-Userinfo">
                <span class="space">当前用户:</span><a>张测试</a><span class="space">部门:</span><a>技术部</a><a
                    class="space">退出</a>
            </div>
            <div class="clear">
            </div>
        </div>
        <div class="apply_content">
            <div class="sort-title">
            </div>
            <div class="apply_cn1">
                <div class="apply_cn1-item">
                    人员条件筛选：
                </div>
                @using (Html.BeginForm("Index", "Apply", FormMethod.Get, new { id = "SearchForm" }))
                {
                    @Html.Hidden("Page");
                    <div class="apply_cn1-item1">
                        @*<select id="sort-bar-itemSelect1" name="车辆类型">
                        <option>货车</option>
                        <option>客车</option>
                        <option>轿车</option>
                    </select>*@
                        <input id="key1" name="applicant" type="text" value="申请人" class="ipt-2" />
                    </div>
                    <div class="apply_cn1-item1">
                        @*<select id="sort-bar-itemSelect2">
                        <option>今天</option>
                    </select>*@
                        <input id="key2" name="carType" type="text" value="车辆类型" class="ipt-2" />
                    </div>
                    <div class="apply_cn1-item1">
                        <select id="sort-bar-itemSelect3" name="applyState">
                            <option selected="selected">申请状态</option>
                            <option>未审批</option>
                            <option>已审批</option>
                        </select>
                    </div>
                    <div class="apply_cn1-item2">
                        <input id="Text3" name="key" type="text" value="模糊查找" class="apply_cn1-item2_itp1" /><input
                            type="submit" value="" class="apply_cn1-item2_btn1" />
                    </div>
                }
                <div class="clear">s
                </div>
            </div>
            <table id="applytable" cellspacing="0">
                <tr>
                    <th>
                        申请人
                    </th>
                    <th>
                        申请用车时间
                    </th>
                    <th>
                        申请车辆类型
                    </th>
                    <th>
                        申请用车描述
                    </th>
                    <th>
                        审批状态
                    </th>
                    <th>
                        查看详情
                    </th>
                </tr>
                @foreach (var item in Model)
                {
                    <tr>
                        <td>
                            @Html.DisplayFor(modelItem => item.ApplicantName)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.ApplyTime)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.CarType)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.CarUse)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.ApplyState)
                        </td>
                        <td class="applytable_dt">
                            @*       <a href="javascript:void(0)" onclick="IsApprovalExist(@item.ApplyID)">详情与审批</a>*@
                            @Html.ActionLink("详细与审批", "../Approval/IsApprovalExist", new { id = item.ApplyID })
                        </td>
                    </tr>
                }
            </table>
            <div>
    共<span id="TotalItems"></span>条记录， 每页显示<span id="ItemsPerPage"></span>条， 共<span id="TotalPages"></span>页，
    当前第<span id="CurrentPage"></span>页 <a id="FirstPage" href="javascript:void(0)">首页</a>
    <a id="PrevPage" href="javascript:void(0)">上一页</a> <a id="NextPage" href="javascript:void(0)">
        下一页</a> <a id="LastPage" href="javascript:void(0)">末页</a> <span>跳转到</span>
    <input type="text" id="PageToGo" />
    <input type="button" id="GoToPage" value="Go" />
</div>
        </div>
    </div>
    <div class="clear">
    </div>
</div>
